package com.joinway.framework.core.meta

import groovy.util.Proxy;

class DynaBeanFactory {

	def static getBean(){
		def bean = new Object()
		bean.metaClass.name = "lee"
//		bean.metaClass.getName = {"lee"}
		bean
	}
	
	static GroovyBean getGroovyBean(){
		GroovyBean bean = new GroovyBean()
		bean.metaClass.name = "lee"
		bean
	}

	static def getJavaBean(){
//		JavaBean bean = new JavaBean()
//		bean.metaClass.name = "lee"
//		bean
		ExpandoMetaClass emc = new ExpandoMetaClass( JavaBean, false )
		emc.name = "lee"
		emc.initialize()
		
		def bean = new Proxy().wrap(new JavaBean())
		bean.setMetaClass(emc)
		bean
	}
}
